/**
 * 账户管理页面
 */

import 'package:cbec_app/components/base/base_page.dart';
import 'package:cbec_app/components/base/base_nav_bar.dart';
import 'package:cbec_app/pages/my/controller/withdraw_ctr.dart';
import 'package:cbec_app/routes/routes.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../../components/common/text_arrow_item.dart';

class AccountManage extends GetView<WithDrawController> {
  const AccountManage({super.key});


  @override
  Widget build(BuildContext context) {
    return GetBuilder<WithDrawController>(builder: (controller){
      return BasePage(
      title: "账户管理",
      iconType: IconType.back,
      children: [
        Container(
          margin: EdgeInsets.only(top: 10.w),
        padding: EdgeInsets.fromLTRB(20.w, 0.w, 20.w, 0.w),
        child: Column(
          children: [
            //顶部的管理的添加预付卡
            // _top(),
            _Center(),
            Container(
              height: 460.h,
              margin: EdgeInsets.only(top: 10.w),
              child: ListView(
                children: [
                  ListItem(
                      texts: "待结算金额",
                      hasIcon: false,
                      ohterWidget: Text(
                        controller.frozenAmount.toString(),
                        style: const TextStyle(
                            fontSize: 14,
                            fontWeight: FontWeight.w700,
                            color: Color.fromRGBO(0, 0, 0, 0.90)),
                      ),
                      ontap: () => {}),
                  ListItem(texts: "余额明细", ontap: () => {
                    controller.toSurplusLog()
                  }),
                  ListItem(texts: "提现记录", ontap: () => {
                    controller.toWithdrawList()
                  }),
                  ListItem(texts: "银行卡管理", ontap: () => {
                    Get.toNamed(Routes.bankCard)
                  }),
                ],
              ),
            ),
          ],
        ),
      )
      ],
    );
    });
  }

  

  Widget _Center() => Container(
        height: 134,
        decoration: BoxDecoration(
            borderRadius: BorderRadius.all(Radius.circular(10.0.w)),
            color: Colors.red),
        child: Column(
          children: [
            //上方
            Container(
              height: 100,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  //左边
                  Container(
                        padding: EdgeInsets.only(left: 25.w),
                        height: 100,
                        decoration: BoxDecoration(
                          borderRadius:
                              BorderRadius.all(Radius.circular(10.0.w)),
                          image: const DecorationImage(
                            alignment: Alignment.topLeft,
                            image: AssetImage(
                                'assets/images/my_account_manage_bg.png'),
                            fit: BoxFit.cover,
                          ),
                        ),
                        child: Column(
                          mainAxisAlignment: MainAxisAlignment.center,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Text(
                              "我的余额",
                              style: TextStyle(
                                  fontSize: 12,
                                  fontWeight: FontWeight.w500,
                                  color: Colors.white),
                            ),
                            SizedBox(
                              height: 8,
                            ),
                            Text(
                              controller.amount.toString(),
                              style: TextStyle(
                                  fontSize: 18,
                                  fontWeight: FontWeight.w700,
                                  color: Colors.white),
                            )
                          ],
                        ),
                      ),
                  //右边按钮
                  Container(
                    margin: EdgeInsets.only(right: 10.w),
                    // width: 66.w,
                    height: 28,
                    child: ElevatedButton(
                      style: ButtonStyle(
                        backgroundColor: MaterialStateProperty.all(
                            Color.fromRGBO(255, 181, 3, 1)), // 设置按钮的最小尺寸
                      ),
                      onPressed: () {
                        Get.toNamed(Routes.widthdraw);
                      },
                      child: const Text(
                        "提现",
                        style: TextStyle(
                            fontSize: 13,
                            fontWeight: FontWeight.w500,
                            color: Colors.white),
                      ),
                    ),
                  )
                ],
              ),
            ),
            //下方
            Container(
              height: 30,
              margin: EdgeInsets.only(right: 10.w),
              child: const Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  Text(
                    "规则",
                    style: TextStyle(
                        fontSize: 12,
                        fontWeight: FontWeight.w500,
                        color: Colors.white),
                  ),
                  Icon(
                    Icons.arrow_forward_ios,
                    color: Colors.white,
                    size: 15,
                  )
                ],
              ),
            ),
          ],
        ),
      );
}
